package com.expand.learn.mock;

import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.List;

import static org.mockito.Mockito.verify;

/**
 * @author zhanghaidong
 * @version v1.0
 * @description 注解来使用mock
 * @date 2020/3/13
 */
public class MockitoDemo2Test {

    @Mock
    private List mockList;

    /**
     * 初始化mock
     */
    public MockitoDemo2Test(){
        MockitoAnnotations.initMocks(this);
    }

    @Test
    public void shorthand(){
        mockList.add(1);
        verify(mockList).add(1);
    }
}
